package com.test.tool.demo.websocket;

import lombok.RequiredArgsConstructor;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * 异步推送消息handler
 *
 * @author 小八
 * @date 2022年04月27日15:16
 */
@Service
@RequiredArgsConstructor
public class AynscPushMsgHandler {

    private final SimpMessagingTemplate template;

    @Async
    public void ayscnSend(String user  ,String sendMsg){
        template.convertAndSendToUser(user, "/message",sendMsg );
    }
}
